﻿namespace Sidvall.WorkItemManager.Data.Entity.Entities
{
    public partial class WorkItemSensorLog : global::Sidvall.Data.DataRowBase, global::Sidvall.WorkItemManager.Data.IWorkItemSensorLog
    {
        #region Public Members

        #region Value

        private string _Value;
        public string Value
        { 
            get
            {
                return _Value;
            }
            set
            {
                _Value = value;
            }
        }

        #endregion
        #region ValueTimestamp

        private System.DateTime _ValueTimestamp;
        public System.DateTime ValueTimestamp
        { 
            get
            {
                return _ValueTimestamp;
            }
            set
            {
                _ValueTimestamp = Sidvall.Business.ValidationManager.GetValidUniversalDateTime(value, System.DateTimeKind.Utc);
            }
        }

        #endregion
        #region WorkItemSensorId

        private long _WorkItemSensorId;
        public long WorkItemSensorId
        { 
            get
            {
                return _WorkItemSensorId;
            }
            set
            {
                _WorkItemSensorId = value;
            }
        }

        #endregion
        
        public virtual Sidvall.WorkItemManager.Data.Entity.Entities.WorkItemSensor WorkItemSensor { get; set; }
        
        #region DataRowContextStorageKey

        protected override string DataRowContextStorageKey
        {
            get
            {
                return global::Sidvall.WorkItemManager.Data.Entity.SystemContext.Current.EntityFacade.WorkItemSensorLogManager.GetKey(this);
            }
        }

        #endregion
        #region DataRowStateIsDirty

        protected override bool DataRowStateIsDirty
        {
            get
            {
                return global::Sidvall.WorkItemManager.Data.Entity.SystemContext.Current.EntityFacade.WorkItemSensorLogManager.DataRowStateIsDirty(this);
            }
        }

        #endregion

        #region IWorkItemSensorLog Members

        string global::Sidvall.WorkItemManager.Data.IWorkItemSensorLog.Value
        {
            get
            {
                return this._Value;
            }
            set
            {
                this.Value = value;
            }
        }
        System.DateTime global::Sidvall.WorkItemManager.Data.IWorkItemSensorLog.ValueTimestamp
        {
            get
            {
                return this._ValueTimestamp;
            }
            set
            {
                this.ValueTimestamp = value;
            }
        }
        long global::Sidvall.WorkItemManager.Data.IWorkItemSensorLog.WorkItemSensorId
        {
            get
            {
                return this._WorkItemSensorId;
            }
            set
            {
                this.WorkItemSensorId = value;
            }
        }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
        IWorkItemSensor global::Sidvall.WorkItemManager.Data.IWorkItemSensorLog.WorkItemSensor
        {
            get
            {
                return this.WorkItemSensor;
            }
            set
            {
                this.WorkItemSensor = value as WorkItemSensor;
            }
        }

        #endregion

        #endregion
        #region Constructors

        public WorkItemSensorLog() : this(false, null, null)
        {
        }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public WorkItemSensorLog(bool initializeChildren, Sidvall.Data.IDataRowContextProvider context, Sidvall.Data.DataRowState? dataRowState)
        {
            if ((context != null) || (dataRowState != null))
                SetDataRowContext(context, dataRowState);
            if (initializeChildren)
            {
            }
        }

        #endregion
    }
}